import User from '../model/user.js';
const reducer = (state = {users: [new User()]}, action) => {
  switch (action.type) {
    case 'ADD_USER':
      return addUser(state, action);
    default:
      return state;
  }
}
function addUser(state, action){
  let newState = state;
  let user = new User(null, action.name, action.age, action.gender);
  newState.users.push(user);
  return newState;
}
export default reducer;
